package com.eop.service.impl;

import java.util.Date;
import java.util.List;

import com.eop.dao.IEmergencyStageDao;
import com.eop.entity.EmergencyStage;
import com.eop.service.IEmergencyStageService;

public class EmergencyStageServiceImpl implements IEmergencyStageService {
	private IEmergencyStageDao stageDao;

	public IEmergencyStageDao getStageDao() {
		return stageDao;
	}

	public void setStageDao(IEmergencyStageDao stageDao) {
		this.stageDao = stageDao;
	}

	@Override
	public void deleteStage(EmergencyStage sr) {
		stageDao.delete(sr);
	}

	@Override
	public List<EmergencyStage> getStageByDate(Date date) {
		return stageDao.findAllByNamedQuery("sr.getStageByDate", date);
	}

	@Override
	public EmergencyStage getStageById(String id) {
		return stageDao.getById(id);
	}

	@Override
	public void saveStage(EmergencyStage sr) {
		stageDao.saveOrUpdate(sr);
	}

	@Override
	public List<EmergencyStage> getEmergencyStageByEvent(String eventId) {
		return stageDao.findAllByNamedQuery("es.getStageByEvent", eventId);
	}

	@Override
	public List<EmergencyStage> getAllEmergencyStages() {
		return stageDao.findAllByNamedQuery("es.getAllStage");
	}

}
